<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no" />
		<title></title>
		<script src="js/mui.min.js"></script>
		<link href="css/mui.min.css" rel="stylesheet" />

		<link rel="stylesheet" type="text/css" href="../../../../../cdn.bootcss.com/layer/3.0.1/mobile/need/layer.css" />
		<link rel="stylesheet" type="text/css" href="css/style.css" />
		<script type="text/javascript" src="js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="js/phone.js"></script>
		<script type="text/javascript" src="../../../../../cdn.bootcss.com/layer/3.0.1/mobile/layer.min.js"></script>
		<script type="text/javascript" src="js/login.js"></script>
		<script type="text/javascript" charset="utf-8">
			mui.init();
		</script>
	</head>
	<body>
		<div class="whole">
			<div class="title">叶安察的知乎</div>
			<div class="coordinates-icon">
				<div class="coordinates topAct">
					<img src="image/zhihu.png" />
				</div>
				<div class="circle-1-1 circle-show-2"></div>
				<div class="circle-2-2 circle-show-1"></div>
				<div class="circle-3-3 circle-show"></div>
			</div>
			<div class="login-form">
				<form method="get" id="form">
					<div class="user-name common-div">
						<span class="eamil-icon common-icon">
							<img src="image/eamil.png" />
						</span>
						<input id="username" name="user.username" value="" placeholder="用户名" />
					</div>
					<div class="user-pasw common-div">
						<span class="pasw-icon common-icon">
							<img src="image/password.png" />
						</span>
						<input id="password" type="password" name="user.password" value="" placeholder="密码" />
					</div>
				</form>
				<button type="submit" class="login-btn common-div" id="login">登录</button>

			</div>
			<div class="forgets">
				<a href="#" onclick="pwd()">忘记密码?</a>
				<a href="register.html">注册</a>
			</div>
		</div>
		<script>
			function pwd(){
				mui.toast('请联系管理员┐(´∇｀)┌');
			}
			window.localStorage.setItem("url", "http://192.168.1.106:80/");
			var btn = document.getElementById("login");
			//监听点击事件
			btn.addEventListener("tap", function() {
				//alert(typeof(mui("#username")[0].value))
				$.ajax({
					url: window.localStorage.getItem("url") + "login",
					data: $("#form").serialize(),
					/* {
						username: mui("#user.username")[0].value,
						password: mui("#user.password")[0].value
					}, */
					type: 'GET',
					dataType: 'JSON',
					contentType: "application/x-www-form-urlencoded; charset=UTF-8",
				
					cache: false,
					processData: true,
					success: function(data) {
						if (data != null) {
				
							mui.toast('登录成功');
							window.localStorage.setItem("u_id", data.id);
							mui.openWindow({
								url: './html/index.html',
							});
							setTimeout(function() {
								plus.webview.currentWebview().close();
							}, 1000);
						} else {
							mui.toast('用户名或密码错误！┐(￣ヘ￣)┌');
						}
				
					},
					error: function(XMLHttpRequest, textStatus, errorThrown) {
						//异常处理；
						mui.toast('不知道怎么肥事，不起作用了┐(´∇｀)┌');
					}
				});
			});
		</script>
	</body>
</html>
